<!DOCTYPE html>
<html xmlns="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<base th:href="@{/}" />
<title>Insert title here</title>
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/css/Managerstyle.css}"/>
<script th:src="@{/js/jquery-3.4.1.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
</head>
<body>
	<div class="contain">
		<div class="modify">
			<h3>修改班级</h3>
			<form action="mc/modifyBatch" method="post">
				<dl class="dl-horizontal">
					<dt>所属学院：</dt>
					<dd>
						<select id="select1">
							<option>请选择学院</option>
							<option th:each="acadamy:${acadamylist}" th:value="${acadamy.acdmid}"  th:text="${acadamy.acdmname}"></option>
						</select>
					</dd>
					<br>
					<dt>所属专业：</dt>
					<dd>
						<select id="select2" name="mjid">
							<option>请选择专业</option>
						</select>
					</dd>
					<br>
					<dt>班级名称：</dt>
					<dd><input type="text" required="required" name="bname" th:value="${batch.bname}" class="form-control" style="width: 250px;"></dd>
					<br>
					<dt>班级容量：</dt>
					<dd><input type="number" min="1" max="100" required="required" name="bcapacity" th:value="${batch.bcapacity}" class="form-control" style="width: 250px;"></dd>
				</dl>
				<input type="hidden" name="bid" th:value="${batch.bid}">
				<input type="submit" class="btn btn-primary" value="提 交">
			</form>
		</div>
	</div>

	<script>
			$(document).ready(function(){
				$("#select1").change(function(){
					var str2 = "<option>请选择专业</option>";
					$.ajax({
						url: 'mc/getMajorByacdmid',
						type: 'GET',
						data: {acdmid: $("#select1").val()},
						success: function(data){
							var str1 = "";
							$("#select2").empty();
						 	$("#select2").append(str2); 
							$.each(data,function(index,value){
								str1 = "<option value='"+ value.mjid +"'>" +  value.term.tyear + value.mjname + "</option>";
								$("#select2").append(str1);
							});
						},
						error: function(req,status,error){
							$("#select2").empty();
							$("#select2").append(str2);
						}
					}); 
				});
			});
	</script>
</body>
</html>